package couk.mmtdigital.sm
{
	import couk.mmtdigital.sm.control.commands.CheckOutCommand;
	import couk.mmtdigital.sm.control.commands.DownloadCommand;
	import couk.mmtdigital.sm.control.commands.FileListCommand;
	import couk.mmtdigital.sm.control.commands.LoginCommand;
	import couk.mmtdigital.sm.control.commands.LogoutCommand;
	import couk.mmtdigital.sm.control.commands.NewFolderCommand;
	import couk.mmtdigital.sm.control.commands.StartUpCommand;
	import couk.mmtdigital.sm.control.commands.UploadCommand;
	
	import org.puremvc.as3.patterns.facade.Facade;

	public class ApplicationFacade extends Facade
	{
		//commands
		public static const STARTUP:String = "startup";
		public static const LOGIN:String = "login";
		public static const LOGOUT:String = "logout";
		public static const FILELIST:String = "filelist";
		public static const NEWFOLDER:String = "newfolder";
		public static const UPLOADNEWFILE:String = "uploadnewfile";
		public static const DOWNLOADFILE:String = "downloadfile";
		public static const CHECKOUTFILE:String = "checkoutfile";
		//views
		public static const LOGGED:String = "logged";
		public static const LOGGEDOUT:String = "loggedout";
		public static const UPDATELIST:String = "updatelist";
		public static const ONSELECTEDFILE:String = "onselectedfile";
		public static const FILEPANELNEWFOLDER:String = "filepanelnewfolder";
		public static const UPLOADVIEW:String = "uploadview";
		public static const NEWFILE:String = "newfile";
		public static const PROGRESSUPDATE:String = "pogressupdate";
		
		public static function getInstance():ApplicationFacade{
			if(instance == null) instance = new ApplicationFacade();
			return instance as ApplicationFacade;
		}
		
		override protected function initializeController():void{
			super.initializeController();
			registerCommand(STARTUP, StartUpCommand);
			registerCommand(LOGIN, LoginCommand);
			registerCommand(LOGOUT, LogoutCommand);
			registerCommand(FILELIST, FileListCommand);
			registerCommand(NEWFOLDER, NewFolderCommand);
			registerCommand(UPLOADNEWFILE, UploadCommand);
			registerCommand(DOWNLOADFILE, DownloadCommand);
			registerCommand(CHECKOUTFILE, CheckOutCommand);
		}
		
		public function startup(app:SpreadsheetManager):void{
			sendNotification(STARTUP, app);
		}
	}
}